﻿using Estsh.Core.Wms.IServices;
using Estsh.Core.Model.Result;
using Microsoft.AspNetCore.Mvc;
using Estsh.Core.Models;
using Estsh.Core.Controllers;

namespace Estsh.Core.Web.Areas.Wms.Controllers.NC
{
    [Route("wms/[controller]")]
    [ApiController]
    public class StockQueryController : WmsBaseController
    {
        private IStockQueryService service;

        // GET: LoginController
        public StockQueryController(IStockQueryService _service)
        {
            service = _service;
        }

        [HttpPost("GetStockQueryList")]
        public IActionResult GetStockQueryList(Newtonsoft.Json.Linq.JObject jobj)
        {
            string partSpec = jobj["partSpec"].ToString().Trim();

            WmsResponseResult result = new WmsResponseResult();
            try
            {
                SetObjectDetail obj = service.GetStockQueryList(partSpec);
                result.Success = true;
                result.Data = obj;
            }
            catch (Exception ex)
            {
                result.Msg = ex.Message;
            }
            return Json(result);
        }
        
    }
}
